ANALYTICS

Public Support for Free Speech

Linear Regression

Photo by Marie S on Unsplash

Photo by Marie S on Unsplash

What is freedom of expression? Without the freedom to offend, it ceases to exist…
— Salman Rushdie


Ingest the data

life satisfaction, gdp, and population by country and year

# Load csv data file
url_root <- "archetypes/"

url_file1 <- "vdem-v2x_freexp.csv"
url1 <- paste0(url_root, url_file1)

df_vdem <- read.csv(url1, header = TRUE, stringsAsFactors = FALSE)
df_vdem
url_file2 <- "justitia-free-speech-index.csv"
url2 <- paste0(url_root, url_file2)

df_justitia <- read.csv(url2, header = TRUE, stringsAsFactors = FALSE)
df_justitia

Wrangle the data

country codes and join

df_justitia$ISO3 <- countrycode(df_justitia$COUNTRY_DATA, origin='country.name', destination='iso3c')
# df_justitia

df_combined <- merge(df_justitia, df_vdem, by.x='ISO3', by.y='country_text_id')
df_combined$Region <- countrycode(df_combined$ISO3, origin='iso3c', destination='un.region.name')
# df_combined

df_final <- df_combined %>% select(c(ISO3, country_name, v2x_freexp, Free_Speech_Index, Region))
df_final

Visualizing the possible relationship

theme_opts <- theme(
  text = element_text(family = "inconsolata", size = 25), 
  plot.title = element_text(color = "black", size = 25, face = "bold"),
  plot.subtitle = element_text(color = "black", size = 25),
  plot.caption = element_text(color = "#555555", size = 25)
)

g1 <- ggplot(df_final, aes(x=Free_Speech_Index, y=v2x_freexp)) +
  geom_point(size = 3) +
  labs( title = "You can't always get what you want",
        subtitle = "Desired v actual freedom of speech",
        # caption = "Source: V-Dem Institute, Justitia",
        x = "Less <- Public support for speech, 2020 -> More",
        y = "Amount of permitted free speech, 2020") +
  theme_bw() +
  theme_opts

girafe(ggobj = g1, width_svg = 16, height_svg = 9,
       options = list(opts_sizing(rescale = TRUE, width = 0.8))
)

Linear Regression Plot

lm

We model the relationship between the amount of permitted free speech and its public support in 2020 using a linear regression. With the linear model, we observed a positive relation between the two variables. The public support for speech amount is directly proportional to the amount of permitted free speech. In other words, the higher is the public support for speech, the higher is the occurrence of permitted free speech.

Fitting the model

We now run a linear regression using function lm

# lm required parameters
# lm(formula, data)

simple_fit = lm(v2x_freexp~Free_Speech_Index, data = df_final) #Create the linear regression
summary(simple_fit) #Review the results
## 
## Call:
## lm(formula = v2x_freexp ~ Free_Speech_Index, data = df_final)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -0.6300 -0.0519  0.0517  0.1178  0.3075 
## 
## Coefficients:
##                   Estimate Std. Error t value Pr(>|t|)   
## (Intercept)       0.091873   0.182733   0.503  0.61868   
## Free_Speech_Index 0.010570   0.002921   3.619  0.00104 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.2144 on 31 degrees of freedom
## Multiple R-squared:  0.297,  Adjusted R-squared:  0.2743 
## F-statistic: 13.09 on 1 and 31 DF,  p-value: 0.001041

Visualizing the model results

g2 <- g1 + 
  geom_abline(intercept = simple_fit$coefficients[1], 
              slope = simple_fit$coefficients[2], color = "#33abdd", size = 2, linetype = 'dashed') +
  theme_opts

girafe(ggobj = g2, width_svg = 16, height_svg = 9,
       options = list(opts_sizing(rescale = TRUE, width = 0.8))
)

Plot with annotations

some narrative to help tell the story

v2 <- g2 +
  geom_text_repel(aes(label = country_name), direction = "y", min.segment.length = 0.0, nudge_y = 0.02, point.padding = 0.2, family = "inconsolata")

girafe(ggobj = v2, width_svg = 16, height_svg = 9,
       options = list(opts_sizing(rescale = TRUE, width = 0.8)))

References

citations for narrative and data sources

  • Narrative Inspiration: The Economist, In some countries, people think they have too much freedom of speech.
  • Data Source: Justitia, Who Cares about Free Speech?, GO
  • Data Source: V-Dem Institute, Varieties of Democracy Project, GO